package com.chengyu.core.exception;

import com.chengyu.core.result.IResultEnum;



public class CommonException extends RuntimeException {

    private static final long serialVersionUID = 348342987834878487L;

    /**
     * 错误码
     */
    private Integer code;
    private String[] params;
    /**
     * 错误信息
     */
    private String message;
    public CommonException() {
        super();
    }

    public String[] getParams() {
        return params;
    }

    public CommonException(String message) {
        super(message);
        this.message = message;
    }

    public CommonException(IResultEnum iResultEnum) {
        super(iResultEnum.getCode() + "-" + iResultEnum.getMessage());
        this.code = iResultEnum.getCode();
        this.message = iResultEnum.getMessage();
    }

    public CommonException(IResultEnum iResultEnum, Throwable throwable) {
        super(iResultEnum.getCode() + "-" + iResultEnum.getMessage() + ", " + throwable.getMessage(), throwable);
        this.code = iResultEnum.getCode();
        this.message = iResultEnum.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
